package com.example.mybatispdemo.store.service;

import com.example.mybatispdemo.store.entity.ProductEntity;
import com.baomidou.mybatisplus.extension.service.IService;
import com.example.mybatispdemo.store.exception.ProductException;

import java.util.List;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author ljp
 * @since 2022-10-29
 */
public interface IProductService extends IService<ProductEntity> {
    /**
    *
     * 添加商品
     * @param product
     * @return boolean
     */
    public boolean addProduct(ProductEntity product);
    /**
     * 根据id查找商品
      * @param id
     * @return boolean*/
    public ProductEntity getProductById(Integer id) throws ProductException;
    /**
    *
     * 根据商品名查找商品
     * @param name
     * @return com.example.mybatispdemo.store.entity.ProductEntity
    */
    public List<ProductEntity> getProductByName(String name) throws ProductException;
    /**
    *
     * 根据姓名和库存查找
     * @param name
     * @param quantity
     * @return com.example.mybatispdemo.store.entity.ProductEntity

    */
    public List<ProductEntity> getProuctByNameQuantity(String name, Float quantity) throws ProductException;
    /**
    *
     * 根据id更新商品
     * @param id
     * @return boolean
    */
    public boolean updateProductById(Integer id,ProductEntity product);
    /**
    *
     * 删除商品
     * @param id
     * @return boolean
    */
    public boolean deleteProductById(Integer id);
    /**
    *
     * 删除所有商品
     * @param
     * @return boolean
    */
    public boolean deleteAll();
}
